<template>
  <view class="flex-box-page">
    <User :avatar="user.avatar" :name="user.nickname || user.username" url="/pages/user-info/user-info" isLink></User>
    <view class="flex-box-item">
      <u-list>
        <u-list-item>
          <u-cell-group :customStyle="{backgroundColor: '#fff'}">
            <u-cell title="我的物品" isLink url="/pages/my-goods/my-goods"></u-cell>
            <u-cell title="上传商品" isLink url="/pages/upload-goods/upload-goods"></u-cell>
            <u-cell title="我的空间" isLink url="/pages/my-news/my-news"></u-cell>
            <u-cell title="个人主页" isLink :url="`/pages/business-home/business-home?id=${user._id}`"></u-cell>
            <!-- #ifdef H5 -->
            <u-cell title="下载APP" isLink @click="downloadAPP"></u-cell>
            <!-- #endif -->
            <!-- #ifdef APP-PLUS -->
            <!-- <u-cell title="检查新版本" isLink @click="updateApp"></u-cell> -->
            <!-- #endif -->
            <!-- <u-cell title="我的反馈" isLink url="/pages/componentsB/badge/badge"></u-cell> -->
          </u-cell-group>
        </u-list-item>
        <!-- <u-list-item>
          <u-cell-group :customStyle="{backgroundColor: '#fff'}">
            <u-cell title="设置" isLink url="/pages/componentsB/tag/tag"></u-cell>
          </u-cell-group>
        </u-list-item>
        <u-list-item> -->
          <u-button v-if="user.token" type="error" text="退出登录" @click="$store.commit('logout')"></u-button>
          <u-button v-else type="primary" text="登录" @click="$nav.to('/pages/login/login')"></u-button>
        </u-list-item>
      </u-list>
    </view>
  </view>
</template>

<script>
  import { checkAppUpdate } from '@/utils/tools.js'
  export default {
    data() {
      return {
        pic: 'https://uviewui.com/common/logo.png',
        show: true
      }
    },
    computed: {
      user() {
        return this.$store.state.user
      }
    },
    onLoad() {
      console.log('***********************************************')
      console.log('this.joinDomain', this.joinDomain)
    },
    methods: {
      downloadAPP() {
        location.href = 'http://www.mini-cloud.top/download/market.apk'
      },
      updateApp() {
        // checkAppUpdate()
        const view = new plus.nativeObj.View('test',
        	{top: '50%', height:'300px',width:'100%', backgroundColor: '#aaffff'},
          
        	[
            {tag:'img',id:'img',src:'../../static/bless2.png',position:{top:'0px',left:'0px',width:'100%',height:'100px'}},
            {tag:'rect',id:'rect',color:'#000000',position:{top:'0px',left:'0px',width:'100%',height:'100px'}},
            {tag:'font',id:'font',text:'原生控件',textStyles:{size:'18px'}}
        	]);
          console.log(view)
        	view.show();
        return
        uni.showModal({
          title: 'APP更新',
          content: '更新内容',
          showCancel: true,
          cancelText: '取消',
          cancelColor: '#000000',
          confirmText: '确认',
          success() {
            
          },
          fail() {
            
          }
        })
      }
    }
  }
</script>

<style lang="scss">
  page {
    background-color: #ededed;
  }

  .camera {
    width: 54px;
    height: 44px;

    &:active {
      background-color: #ededed;
    }
  }

  .user-box {
    background-color: #fff;
  }

  .u-list-item {
    margin-top: 20rpx;
  }
  
  ::v-deep .u-button{
    margin-top: 50rpx;
  }
</style>
